Socket
Socket
Sign inDemoInstall

@smithy/service-error-classification

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/service-error-classification


Version published
Weekly downloads
14M
increased by2.79%
Maintainers
2
Install size
332 kB
Created
Weekly downloads
 

Package description

What is @smithy/service-error-classification?

@smithy/service-error-classification is an npm package designed to help classify and handle service errors in a structured and consistent manner. It provides utilities to identify different types of errors, such as client errors, server errors, and throttling errors, and allows developers to handle these errors appropriately in their applications.

What are @smithy/service-error-classification's main functionalities?

Classify Client Errors

This feature allows you to classify whether an error is a client error (4xx status codes). The code sample demonstrates how to use the `isClientError` function to check if an error is a client error.

const { isClientError } = require('@smithy/service-error-classification');

const error = { statusCode: 400 };
if (isClientError(error)) {
  console.log('This is a client error.');
}

Classify Server Errors

This feature allows you to classify whether an error is a server error (5xx status codes). The code sample demonstrates how to use the `isServerError` function to check if an error is a server error.

const { isServerError } = require('@smithy/service-error-classification');

const error = { statusCode: 500 };
if (isServerError(error)) {
  console.log('This is a server error.');
}

Classify Throttling Errors

This feature allows you to classify whether an error is a throttling error (typically 429 status code). The code sample demonstrates how to use the `isThrottlingError` function to check if an error is a throttling error.

const { isThrottlingError } = require('@smithy/service-error-classification');

const error = { statusCode: 429 };
if (isThrottlingError(error)) {
  console.log('This is a throttling error.');
}

Other packages similar to @smithy/service-error-classification

Readme

Source

@smithy/service-error-classification

NPM version NPM downloads

FAQs

Last updated on 14 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc